﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace _055.UDP客户端
{
	internal class Program
	{
		static void Main(string[] args)
		{
			// 服务器不在线会丢包

			// Dgram 点报
			Socket udpClient = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
			byte[] data = Encoding.UTF8.GetBytes("你好，udp客户端上线了");
			IPAddress iPAddress = new IPAddress(new byte[] { 10, 34, 200, 36 });
			// IP + Port
			IPEndPoint iPEndPoint = new IPEndPoint(iPAddress, 7788);
			udpClient.SendTo(data, iPEndPoint);

			udpClient.Close();

		}
	}
}
